<?php

namespace app\admin\command;

use think\console\Command;
use think\console\Input;
use think\console\input\Option;
use think\console\Output;
use think\Db;
use think\Exception;

class VipCard extends Command
{

    protected function configure()
    {
        // 指令配置
        $this->setName('VipCard');
        // 设置参数
        $this->setDescription('数据统计')->setHelp("php think VipCard");
    }

    protected function execute(Input $input, Output $output)
    {
        $output->writeln('开始执行');
        // 查询用户会员卡
        $map = [];
        $map['status'] = ['in', [1,2],'status'];
        $map['vip_card_time'] = ['elt', time()];
        $updateResult = Db::name('user_card')->where($map)->update(['status' => 2]);
        if ($updateResult !== false) {
            $output->writeln('执行结束');
        } else {
            $output->writeln('执行失败');
        }

    }
}
